home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / elk-2_0.lha / elk-2.0 / examples / scheme / acker next >
Encoding:
Text File  |  1991-09-25  |  221 b   |  15 lines

  1. ;;; -*-Scheme-*-
  2. ;;;
  3. ;;; The Ackermann function
  4.  
  5. (define (acker x y)
  6.   (cond
  7.     ((zero? x)
  8.       (+ y 1))
  9.     ((zero? y)
  10.       (acker (- x 1) 1))
  11.     (else
  12.       (acker (- x 1) (acker x (- y 1))))))
  13.  
  14. (print (acker 3 2))
  15.